/*
 *  Circle.h
 *  BugFix
 *
 *  Created by Dmitry Fadeev on 9/14/11.
 *  Copyright 2011 Arello Mobile. All rights reserved.
 *
 */

#pragma once

#include <physics/Node.h>
#include <physics/NodeLoader.h>
#include <box2d/common/b2Math.h>
#include <physics/Types.h>

namespace physics
{

class Circle: public Node
{
	PHYSICS_NODE_REGISTER(Circle)
private:
	friend class CircleLoader;
	float radius;
public:
	Circle(World *world);
	Circle(World *world, float radius, const Vector2 & center = Vector2(0.0f, 0.0f));
	virtual ~Circle() {}

	virtual std::auto_ptr <xml::ObjectANSI> CreateLoader();
	virtual Vector2 GetSize() const;
};



class CircleLoader: public NodeLoader
{
	float radius;
	Vector2 center;

	virtual bool on_attribute(xml::Provider *prov, const std::string &name, const std::string &value);
	virtual std::auto_ptr <b2Shape> CreateShape();

public:
	CircleLoader(Circle *node): NodeLoader(node) {}
};

}	// namespace physics